package leetcode_0424

import (
	"strings"
)

func letterCombinations1(digits string) []string {

	var result []string
	phone := map[byte]string{'2': "abc", '3': "def", '4': "ghi", '5': "jkl", '6': "mno", '7': "pqrs", '8': "tuv", '9': "wxyz"}

	// 空的返回
	if len(digits) == 0 {
		return []string{}
	}

	if len(digits) == 1 {
		return strings.Split(phone[digits[0]], "")
	}

	for i := 0; i < len(phone[digits[0]]); i++ {
		tmp := letterCombinations1(digits[1:])
		for j := 0; j < len(tmp); j++ {
			result = append(result, string(phone[digits[0]][i])+tmp[j])
		}
		//phone[digits[0]][i] = append()
	}

	return result
}
